<template>
    <div style="width:60%;padding:0 2%">
        <!-- 项目经历 -->
         <h1 class="name"><i class="el-icon-arrow-left back" @click="goBack()"></i>添加项目经历</h1>
         <el-form ref="form" :model="form" label-width="80px">
            <el-form-item label="项目名称" style="width:300px;">
                <el-input v-model="form.name" placeholder="请输入项目名称"></el-input>
            </el-form-item>
            <el-form-item label="项目角色" style="width:320px;">
                <el-select v-model="form.role" placeholder="请选择项目角色">
                <el-option label="产品经理" value="产品经理"></el-option>
                <el-option label="项目经理" value="项目经理"></el-option>
                <el-option label="架构师" value="架构师"></el-option>
                <el-option label="开发工程师" value="开发工程师"></el-option>
                <el-option label="开发工程师" value="开发工程师"></el-option>
                <el-option label="人机工程师" value="人机工程师"></el-option>
                <el-option label="配置管理员" value="配置管理员"></el-option>
                <el-option label="QA" value="QA"></el-option>
                <el-option label="SCM" value="SCM"></el-option>
                </el-select>
            </el-form-item>
             <el-form-item label="项目链接" style="width:300px;">
                <el-input v-model="form.link" placeholder="没有可不填"></el-input>
            </el-form-item>
            <el-form-item label="时间段">
                <el-col :span="11">
                <el-date-picker type="date" placeholder="开始时间" v-model="form.date1" style="width: 100%;"></el-date-picker>
                </el-col>
                <el-col class="line" :span="2">-</el-col>
               <el-col :span="11">
                <el-date-picker type="date" placeholder="结束时间" v-model="form.date2" style="width: 100%;"></el-date-picker>
                </el-col>
            </el-form-item>
        
            <el-form-item label="项目描述">
                <el-input type="textarea" v-model="form.desc" rows="3px"></el-input>
            </el-form-item>
            <el-form-item label="项目业绩">
                <el-input type="textarea" v-model="form.achievement" rows="3px" placeholder="选填"></el-input>
            </el-form-item>
            <el-form-item> 
                <el-button @click="resetForm()" class="chongzhi">重置</el-button>
                <el-button type="primary" @click="submitForm2('form')" class="button">立即添加</el-button>
            </el-form-item>
         </el-form>
    </div>
</template>

<script>
export default {
     data() {
      return {
        form: {
          name: '',
          link:'',
          role: '',
          date1: '',
          date2: '',
          achievement: '',
          desc: '',
        }
      }
    },
    methods:{
         goBack(){
            this.$router.push("./PersonalResume")
         },
         resetForm() {
           let a = this.form
            a.name = ''
            a.link = ''
            a.role =  ''
            a.date1 =  ''
            a.date2 =  ''
            a.achievement = ''
            a.desc = ''
        },
        submitForm2(){
            depot.post({
              url:'/empservice/projectexp/addProjectExp',
              data:{
                'description':this.form.desc,
                'endtime':this.form.date1,
                'starttime':this.form.date2,
                'internet':this.form.link,
                'name':this.form.name,
                'people':this.form.role,
                'reward':this.form.achievement
              },
              cb:(res)=>{
                alert(res.message)
                if(res.code === 20000){
                    this.$router.push("/PersonalResume")
                }
              }
          })
        }
    },
    mounted:function(){
        // this.bus.$on('id',(r)=>{
        //     console.log(r);
        //     this.id = r;
        //     console.log(this.id);
        // })
    }
}
</script>

<style lang="less" scoped>
.name{
    color: #353535;
    font-size: 26px;
}    
.button{
    margin-left: 163px;
    float: right;
    background-image: linear-gradient(#7a7878, #5a5a5a);
    border: none;
}
.chongzhi{
    margin-left: -70px;
}
.back{
    font-size: 20px;
    margin-left: 10px;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    font-weight: 600;
    border-radius: 50%;
    margin-right: 30px;
}
</style>